package com.atguigu.gulimall.cart.feign;

import com.atguigu.common.constant.FeignConstant;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.cart.feign.fallback.ProductFeignServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.math.BigDecimal;
import java.util.List;

@FeignClient(value=FeignConstant.PROEUCT_SERVICE,fallback = ProductFeignServiceFallBack.class)
public interface ProductFeignService {
    /**
     * 根据skuId获取商品信息
     */
    @RequestMapping(FeignConstant.CONTROLLER_PROEUCT_SKUINFO+FeignConstant.METHOD_PROEUCT_SKUINFO_INFO)
    R getSkuInfo(@PathVariable("skuId") Long skuId);

    /**
     * 根据skuId获取销售属性
     * @param skuId
     * @return
     */
    @RequestMapping(FeignConstant.CONTROLLER_PROEUCT_SKUSALEATTRVALUE+FeignConstant.METHOD_PROEUCT_SKUSALEATTRVALUE_STRINGLIST)
    List<String> getSkuSaleAttrValues(@PathVariable("skuId") Long skuId);


    @GetMapping(FeignConstant.CONTROLLER_PROEUCT_SKUINFO+FeignConstant.METHOD_PROEUCT_SKUINFO_PRICE)
    BigDecimal getPrice(@PathVariable("skuId") Long skuId);
}
